function P2(list){
    base(this,LSprite,[]);//此类继承Sprite
    var self=this;

    self.way='left';

    self.bg=new LBitmap(new LBitmapData(datalist['bg1']));
    self.addChild(self.bg);

    self.bird=new BirdMove();
    self.addChild(self.bird);

    self.home=new LSprite();
    self.home.body=new LBitmap(new LBitmapData(datalist['home']));
    self.home.addChild(self.home.body);
    self.addChild(self.home);
    self.home.x=10;
    setTimeout(function(){
        self.home.y=10+self.y*-1;
    },100);

    self.car=new LBitmap(new LBitmapData(datalist['car2']));
    self.addChild(self.car);
    self.car.targetX=-55;
    self.car.x=-55;
    self.car.y=425;

    self.z1=new LBitmap(new LBitmapData(datalist['s1_z1']));
    self.addChild(self.z1);
    self.z1.targetX=55;
    self.z1.x=self.z1.targetX+100;
    self.z1.y=166;
    self.z1.alpha=0;

    self.z2=new LBitmap(new LBitmapData(datalist['s1_z2']));
    self.addChild(self.z2);
    self.z2.targetX=stageW/2-self.z2.getWidth()/2;
    self.z2.x=self.z2.targetX;
    self.z2.y=stageH-self.z2.getHeight()-20+self.y*-1;
    self.z2.alpha=0;

    self.home.addEventListener(LMouseEvent.MOUSE_DOWN,function(){
        if(isClick==false)return;
        isClick=false;
        game.subOut();
    });



    //第二屏
    self.car2=new LBitmap(new LBitmapData(datalist['car3']));
    self.addChild(self.car2);
    self.car2.targetX=1864;
    self.car2.x=self.car2.targetX+300;
    self.car2.y=230;

    self.z3=new LBitmap(new LBitmapData(datalist['s2_z1']));
    self.addChild(self.z3);
    self.z3.targetX=1940;
    self.z3.x=self.z3.targetX+800;
    self.z3.y=178;

    self.z4=new LBitmap(new LBitmapData(datalist['s2_z2']));
    self.addChild(self.z4);
    self.z4.targetX=1945;
    self.z4.x=self.z4.targetX+1000;
    self.z4.y=stageH-self.z4.getHeight()-20+self.y*-1;


    self.addEventListener(LMouseEvent.MOUSE_DOWN,function(){
        if(isClick==false)return;
        isClick=false;
        if(self.way=='left'){
            self.way='right';
            self.toSub2();
        }else{
            self.way='left';
            self.toSub1();
        }
    });
}

P2.prototype.subOut=function(){
    var self=this;

    self.z1.x=self.z1.targetX+100;
    self.z1.alpha=0;
    self.z2.alpha=0;
    self.bird.myKill();
}

P2.prototype.sub1In=function(){
    var self=this;

    LTweenLite.to(self.z1,0.5,{alpha:1,x:self.z1.targetX,ease:Cubic.easeOut});
    LTweenLite.to(self.z2,0.5,{alpha:1,delay:0.3,onComplete:function(){
        self.bird.myMove();
        isClick=true;
    }});
}


P2.prototype.toSub2=function(){
    var self=this;
    LTweenLite.to(self.z1,0.8+1,{x:self.z1.targetX-500,ease:Cubic.easeOut});
    LTweenLite.to(self.z2,0.8+1,{x:self.z2.targetX-800,ease:Cubic.easeOut});
    LTweenLite.to(self.car,0.8+1,{x:self.car.targetX-100,ease:Cubic.easeOut});
    LTweenLite.to(self,2,{x:-1920,ease:Cubic.easeInOut});

    LTweenLite.to(self.car2,1.0+1,{x:self.car2.targetX,ease:Cubic.easeOut,delay:0.2});
    LTweenLite.to(self.z3,1.5+1,{x:self.z3.targetX,ease:Cubic.easeOut,delay:0});
    LTweenLite.to(self.z4,1.9+1,{x:self.z4.targetX,ease:Cubic.easeOut,delay:0,onComplete:function(){
        isClick=true;
    }});
}


P2.prototype.toSub1=function(){
    var self=this;

    LTweenLite.to(self.car2,1.1+1,{x:self.car2.targetX+300,ease:Cubic.easeOut});
    LTweenLite.to(self.z3,1.1+1,{x:self.z3.targetX+800,ease:Cubic.easeOut});
    LTweenLite.to(self.z4,1.1+1,{x:self.z4.targetX+1000,ease:Cubic.easeOut});
    LTweenLite.to(self,2,{x:0,ease:Cubic.easeInOut});

    LTweenLite.to(self.z1,2.4+0.5,{x:self.z1.targetX-0,ease:Cubic.easeOut});
    LTweenLite.to(self.z2,2+0.5,{x:self.z2.targetX-0,ease:Cubic.easeOut,onComplete:function(){
        isClick=true;
    }});
    LTweenLite.to(self.car,1.7+0.5,{x:self.car.targetX-0,ease:Cubic.easeOut});
}








